package com.zz.parkingsystem.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

import java.util.ArrayList;

/**
 * 配置swagger
 * swagger在线文档地址：localhost:8080/swagger-ui
 */
@Configuration
public class Swagger3Config {

    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.OAS_30)  // 指定swagger3.0版本
                .groupName("SuperTeam")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.zz.parkingsystem.controller"))  // 指定扫描的包  常用方式
                .build()
                .apiInfo(createApiInfo());
    }

    @Bean
    public ApiInfo createApiInfo() {
        return new ApiInfo(
                "Api Documentation",  //标题
                "智慧泊车项目Api文档",//描述
                "3.0",             //版本
                "localhost:8080/swagger-ui/index.html",//团队链接
                new Contact("zz", "https://www.wangzhaoo.com", "980540247@qq.com"),
                "Apache 2.0",
                "https://www.apache.org/licenses/LICENSE-2.0",
                new ArrayList());
    }
}
